using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;

namespace WozLib.UI.Util
{
//''' <summary>
//''' Enables Xaml String fromating.
//''' </summary>
//''' <remarks>
//''' Example:
//''' <example>
//''' <code>
//''' Text="{Binding Text, Converter=sfc, ConverterParameter=0.00}"
//''' </code>
//''' </example>
//''' </remarks>
  class StringFormatConverter : IValueConverter
  {
    #region IValueConverter Members

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      string format = parameter.ToString();

      return String.Format("{0:" + format + "}", value);
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      return System.Convert.ChangeType(value, targetType);
    }

    #endregion
  }
}
